﻿#include "cpushbutton-plugin.h"

#include "cpushbutton.h"
#include <QtPlugin>

CPushButtonPlugin::CPushButtonPlugin(QObject *parent) : QObject(parent)
{
    m_initialized = false;
}

void CPushButtonPlugin::initialize(QDesignerFormEditorInterface * /* core */)
{
    if (m_initialized) return;
    m_initialized = true;
}

bool CPushButtonPlugin::isInitialized() const
{
    return m_initialized;
}

QWidget *CPushButtonPlugin::createWidget(QWidget *parent)
{
    auto btn = new CPushButton(parent);
    btn->setText("CPushButton");
    btn->setTextMargin(9, 9, 9, 9);
    btn->setRadius(15);
    return btn;
}

QString CPushButtonPlugin::name() const
{
    return QLatin1String("CPushButton");
}

QString CPushButtonPlugin::group() const
{
    return QLatin1String("Nbc Widgets");
}

QIcon CPushButtonPlugin::icon() const
{
    return QIcon("://ico/Loading.png");
}

QString CPushButtonPlugin::toolTip() const
{
    return QLatin1String("");
}

QString CPushButtonPlugin::whatsThis() const
{
    return QLatin1String("");
}

bool CPushButtonPlugin::isContainer() const
{
    return false;
}

QString CPushButtonPlugin::domXml() const
{
    return QLatin1String(
        "<widget class=\"CPushButton\" name=\"CPushButton\">\n</widget>\n");
}

QString CPushButtonPlugin::includeFile() const
{
    return QLatin1String("cpushbutton.h");
}
